package com.sky.mapper;

import com.sky.entity.SetMealDish;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 套餐菜品Mapper
 */
@Mapper
public interface SetMealDishMapper {

    /**
     * 根据菜品dishIds查询套餐Ids
     * @param dishIds 菜品dishIds
     * @return 套餐Ids
     */
    // select setmeal_id from setmeal_dish where dish_id in (1,2,3,4)
    List<Long> getSetMealIdsByDishIds(List<Long> dishIds);

    /**
     * 添加套餐菜品
     * @param setMealDishes 套餐菜品
     */
    void insertSetMealDish(List<SetMealDish> setMealDishes);

    /**
     * 删除套餐菜品
     * @param setMealIds 套餐Ids
     */
    void deleteSetMealDishBySetMealIds(List<Long> setMealIds);

    /**
     * 根据套餐id查询菜品
     * @param setMealId 套餐id
     * @return 菜品
     */
    @Select("select * from sky_take_out.setmeal_dish where setmeal_id = #{setMealId}")
    List<SetMealDish> queryDishBySetMealId(Long setMealId);

}
